inherited crdGarant: TcrdGarant
  Left = 474
  Top = 199
  Width = 602
  Height = 520
  Caption = #1043#1072#1088#1072#1085#1090#1080#1081#1085#1086#1077' '#1087#1080#1089#1100#1084#1086
  PixelsPerInch = 96
  TextHeight = 13
  inherited Panel1: TPanel
    Top = 446
    Width = 594
  end
  inherited GroupBox1: TGroupBox
    Width = 594
  end
  object GroupBox2: TGroupBox [2]
    Left = 0
    Top = 84
    Width = 594
    Height = 143
    Align = alTop
    Caption = ' '#1043#1072#1088#1072#1085#1090#1080#1081#1085#1086#1077' '#1087#1080#1089#1100#1084#1086' '
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 2
    object Panel5: TPanel
      Left = 2
      Top = 15
      Width = 590
      Height = 69
      Align = alTop
      BevelOuter = bvNone
      TabOrder = 0
      object Label5: TLabel
        Left = 42
        Top = 5
        Width = 94
        Height = 13
        Alignment = taRightJustify
        Caption = #1044#1072#1090#1072' '#1089#1086#1089#1090#1072#1074#1083#1077#1085#1080#1103
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentFont = False
      end
      object Label13: TLabel
        Left = 102
        Top = 26
        Width = 34
        Height = 13
        Alignment = taRightJustify
        Caption = #1057#1091#1084#1084#1072
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentFont = False
      end
      object Label6: TLabel
        Left = 92
        Top = 49
        Width = 44
        Height = 13
        Alignment = taRightJustify
        Caption = #1047#1072#1082#1088#1099#1090#1086
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentFont = False
      end
      object DBDateTimeEditEh1: TDBDateTimeEditEh
        Left = 142
        Top = 2
        Width = 107
        Height = 19
        AlwaysShowBorder = True
        DataField = 'DOCDATE'
        DataSource = dscGarant
        EditButtons = <>
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        Flat = True
        Kind = dtkDateEh
        ParentFont = False
        ShowHint = True
        TabOrder = 0
        Visible = True
      end
      object DBEditEh4: TDBEditEh
        Left = 142
        Top = 24
        Width = 107
        Height = 19
        AlwaysShowBorder = True
        DataField = 'SUMMA'
        DataSource = dscGarant
        EditButtons = <>
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        Flat = True
        ParentFont = False
        ShowHint = True
        TabOrder = 1
        Visible = True
      end
      object DBEditEh15: TDBEditEh
        Left = 158
        Top = 46
        Width = 91
        Height = 19
        AlwaysShowBorder = True
        DataField = 'CLOSEDATE'
        DataSource = dscGarant
        EditButtons = <>
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        Flat = True
        ParentFont = False
        ShowHint = True
        TabOrder = 2
        Visible = True
      end
      object cbMaked: TDBCheckBoxEh
        Left = 142
        Top = 46
        Width = 16
        Height = 17
        AlwaysShowBorder = True
        Color = clBtnFace
        DataField = 'CLOSED'
        DataSource = dscGarant
        Flat = True
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'MS Sans Serif'
        Font.Style = []
        ParentColor = False
        ParentFont = False
        TabOrder = 3
        ValueChecked = '1'
        ValueUnchecked = '0'
      end
    end
    object Panel2: TPanel
      Left = 2
      Top = 84
      Width = 590
      Height = 57
      Align = alClient
      BevelOuter = bvNone
      TabOrder = 1
      object Panel3: TPanel
        Left = 0
        Top = 0
        Width = 142
        Height = 57
        Align = alLeft
        BevelOuter = bvNone
        TabOrder = 0
        object Label11: TLabel
          Left = 90
          Top = 1
          Width = 44
          Height = 13
          Caption = #1047#1072#1084#1077#1090#1082#1080
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -11
          Font.Name = 'MS Sans Serif'
          Font.Style = []
          ParentFont = False
        end
      end
      object Panel4: TPanel
        Left = 142
        Top = 0
        Width = 448
        Height = 57
        Align = alClient
        BevelOuter = bvLowered
        Caption = 'Panel4'
        TabOrder = 1
        object DBMemo1: TDBMemo
          Left = 1
          Top = 1
          Width = 446
          Height = 55
          Align = alClient
          BorderStyle = bsNone
          DataField = 'NOTES'
          DataSource = dscGarant
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clWindowText
          Font.Height = -11
          Font.Name = 'MS Sans Serif'
          Font.Style = []
          ParentFont = False
          TabOrder = 0
        end
      end
    end
  end
  object GroupBox7: TGroupBox [3]
    Left = 0
    Top = 387
    Width = 594
    Height = 59
    Align = alBottom
    Caption = ' '#1057#1083#1091#1078#1077#1073#1085#1099#1077' '
    TabOrder = 3
    object Label20: TLabel
      Left = 26
      Top = 15
      Width = 37
      Height = 13
      Alignment = taRightJustify
      Caption = #1057#1086#1079#1076#1072#1085
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentFont = False
    end
    object Label21: TLabel
      Left = 17
      Top = 37
      Width = 46
      Height = 13
      Alignment = taRightJustify
      Caption = #1048#1079#1084#1077#1085#1077#1085
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentFont = False
    end
    object DBEditEh16: TDBEditEh
      Left = 68
      Top = 13
      Width = 121
      Height = 19
      AlwaysShowBorder = True
      Color = clBtnFace
      DataField = 'CREATEDATE'
      DataSource = dscGarant
      EditButtons = <>
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      Flat = True
      ParentFont = False
      ReadOnly = True
      ShowHint = True
      TabOrder = 0
      Visible = True
    end
    object DBEditEh17: TDBEditEh
      Left = 190
      Top = 13
      Width = 73
      Height = 19
      AlwaysShowBorder = True
      Color = clBtnFace
      DataField = 'CREATOR'
      DataSource = dscGarant
      EditButtons = <>
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      Flat = True
      ParentFont = False
      ReadOnly = True
      ShowHint = True
      TabOrder = 1
      Visible = True
    end
    object DBEditEh18: TDBEditEh
      Left = 190
      Top = 35
      Width = 73
      Height = 19
      AlwaysShowBorder = True
      Color = clBtnFace
      DataField = 'MODIFIER'
      DataSource = dscGarant
      EditButtons = <>
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      Flat = True
      ParentFont = False
      ReadOnly = True
      ShowHint = True
      TabOrder = 2
      Visible = True
    end
    object DBEditEh19: TDBEditEh
      Left = 68
      Top = 35
      Width = 121
      Height = 19
      AlwaysShowBorder = True
      Color = clBtnFace
      DataField = 'MODIFYDATE'
      DataSource = dscGarant
      EditButtons = <>
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      Flat = True
      ParentFont = False
      ReadOnly = True
      ShowHint = True
      TabOrder = 3
      Visible = True
    end
  end
  object GroupBox3: TGroupBox [4]
    Left = 0
    Top = 227
    Width = 594
    Height = 160
    Align = alClient
    Caption = ' '#1043#1088#1072#1092#1080#1082' '#1087#1086#1075#1072#1096#1077#1085#1080#1103' '
    TabOrder = 4
    object DBGridEh1: TDBGridEh
      Left = 2
      Top = 35
      Width = 590
      Height = 123
      Align = alClient
      DataSource = dscGarantSeq
      Flat = True
      FooterColor = clWindow
      FooterFont.Charset = DEFAULT_CHARSET
      FooterFont.Color = clWindowText
      FooterFont.Height = -11
      FooterFont.Name = 'MS Sans Serif'
      FooterFont.Style = []
      TabOrder = 0
      TitleFont.Charset = DEFAULT_CHARSET
      TitleFont.Color = clWindowText
      TitleFont.Height = -11
      TitleFont.Name = 'MS Sans Serif'
      TitleFont.Style = []
      Columns = <
        item
          EditButtons = <>
          FieldName = 'ID'
          Footers = <>
          Visible = False
        end
        item
          EditButtons = <>
          FieldName = 'PMONTH'
          Footers = <>
        end
        item
          EditButtons = <>
          FieldName = 'PYEAR'
          Footers = <>
        end
        item
          EditButtons = <>
          FieldName = 'PSUMMA'
          Footers = <>
          Width = 91
        end
        item
          EditButtons = <>
          FieldName = 'PAID'
          Footers = <>
          ReadOnly = True
          Width = 102
        end>
    end
    object Panel6: TPanel
      Left = 2
      Top = 15
      Width = 590
      Height = 20
      Align = alTop
      BevelOuter = bvNone
      TabOrder = 1
      object DBNavigator1: TDBNavigator
        Left = 0
        Top = 0
        Width = 84
        Height = 20
        DataSource = dscGarantSeq
        VisibleButtons = [nbInsert, nbDelete, nbCancel, nbRefresh]
        Align = alLeft
        Flat = True
        TabOrder = 0
      end
    end
  end
  inherited dsDebt: TpFIBDataSet
    UpdateTransaction = MAINDM.MainTransaction
  end
  object dsGarantSeq: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE RST_GARANT_SEQ'
      'SET '
      '    PMONTH = :PMONTH,'
      '    PYEAR = :PYEAR,'
      '    PSUMMA = :PSUMMA'
      'WHERE'
      '    ID = :OLD_ID'
      '    ')
    DeleteSQL.Strings = (
      'DELETE FROM'
      '    RST_GARANT_SEQ'
      'WHERE'
      '        ID = :OLD_ID'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO RST_GARANT_SEQ('
      '    ID,'
      '    PMONTH,'
      '    PYEAR,'
      '    PSUMMA'
      ')'
      'VALUES('
      '    :ID,'
      '    :PMONTH,'
      '    :PYEAR,'
      '    :PSUMMA'
      ')')
    RefreshSQL.Strings = (
      'select'
      '    gs.id,'
      '    gs.pmonth,'
      '    gs.pyear,'
      '    gs.psumma,'
      '    ('
      '      select -sum(p.summa * pt.csign)'
      '      from rst_pays p'
      '        join spr_pay_types pt on pt.id = p.type_id'
      '          and pt.ispay = 1'
      '      where p.debt_id = g.debt_id'
      '        and getmonth(p.paydate) = gs.pmonth'
      '        and getyear(p.paydate) = gs.pyear'
      '    ) as paid'
      'from rst_garant_seq gs'
      '  join rst_garant g on g.id = gs.garant_id'
      'where(  gs.garant_id = :pgarant_id'
      '     ) and (     GS.ID = :OLD_ID'
      '     )'
      '    ')
    SelectSQL.Strings = (
      'select'
      '    gs.id,'
      '    gs.pmonth,'
      '    gs.pyear,'
      '    gs.psumma,'
      '    ('
      '      select -sum(p.summa * pt.csign)'
      '      from rst_pays p'
      '        join spr_pay_types pt on pt.id = p.type_id'
      '          and pt.ispay = 1'
      '      where p.debt_id = g.debt_id'
      '        and getmonth(p.paydate) = gs.pmonth'
      '        and getyear(p.paydate) = gs.pyear'
      '    ) as paid'
      'from rst_garant_seq gs'
      '  join rst_garant g on g.id = gs.garant_id'
      'where gs.garant_id = :pgarant_id')
    AutoUpdateOptions.UpdateTableName = 'RST_GARANT_SEQ'
    AutoUpdateOptions.KeyFields = 'ID'
    AutoUpdateOptions.GeneratorName = 'GEN_RST_GARANT_SEQ_ID'
    Transaction = trCard
    Database = MAINDM.MainDB
    CSMonitorSupport.Enabled = csmeTransactionDriven
    Left = 300
    Top = 319
    object dsGarantSeqID: TFIBIntegerField
      FieldName = 'ID'
    end
    object dsGarantSeqPMONTH: TFIBSmallIntField
      DisplayLabel = #1052#1077#1089#1103#1094
      FieldName = 'PMONTH'
    end
    object dsGarantSeqPYEAR: TFIBSmallIntField
      DisplayLabel = #1043#1086#1076
      FieldName = 'PYEAR'
    end
    object dsGarantSeqPSUMMA: TFIBBCDField
      DisplayLabel = #1057#1091#1084#1084#1072
      FieldName = 'PSUMMA'
      DisplayFormat = '#,##0.00'
      EditFormat = '0.00'
      Size = 2
      RoundByScale = True
    end
    object dsGarantSeqPAID: TFIBBCDField
      DisplayLabel = #1054#1087#1083#1072#1095#1077#1085#1086
      FieldName = 'PAID'
      DisplayFormat = '#,##0.00'
      EditFormat = '0.00'
      Size = 2
      RoundByScale = True
    end
  end
  object dscGarantSeq: TDataSource
    DataSet = dsGarantSeq
    Left = 336
    Top = 317
  end
  object dsGarant: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE RST_GARANT'
      'SET '
      '    DOCDATE = :DOCDATE,'
      '    NOTES = :NOTES,'
      '    SUMMA = :SUMMA,'
      '    CLOSED = :CLOSED'
      'WHERE'
      '    ID = :OLD_ID'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO RST_GARANT('
      '    ID,'
      '    DEBT_ID,'
      '    DOCDATE,'
      '    NOTES,'
      '    SUMMA,'
      '    CLOSED'
      ')'
      'VALUES('
      '    :ID,'
      '    :DEBT_ID,'
      '    :DOCDATE,'
      '    :NOTES,'
      '    :SUMMA,'
      '    :CLOSED'
      ')')
    SelectSQL.Strings = (
      'SELECT'
      '    g.ID,'
      '    g.DEBT_ID,'
      '    g.DOCDATE,'
      '    g.IS_DELETED,'
      '    g.NOTES,'
      '    g.SUMMA,'
      '    g.CLOSED,'
      '    g.CLOSEDATE,'
      '    g.createdate,'
      '    cu.name as creator,'
      '    g.modifydate,'
      '    mu.name as modifier'
      'FROM'
      '    RST_GARANT g'
      '  left join user_list cu on cu.id = g.createuserid'
      '  left join user_list mu on mu.id = g.modifyuserid'
      'where g.id = :pgarant_id')
    Transaction = trCard
    Database = MAINDM.MainDB
    CSMonitorSupport.Enabled = csmeTransactionDriven
    Left = 328
    Top = 60
    object dsGarantID: TFIBIntegerField
      FieldName = 'ID'
    end
    object dsGarantDEBT_ID: TFIBIntegerField
      FieldName = 'DEBT_ID'
    end
    object dsGarantDOCDATE: TFIBDateField
      FieldName = 'DOCDATE'
      DisplayFormat = 'dd.mm.yyyy'
    end
    object dsGarantIS_DELETED: TFIBSmallIntField
      DefaultExpression = '0'
      FieldName = 'IS_DELETED'
    end
    object dsGarantNOTES: TFIBStringField
      FieldName = 'NOTES'
      Size = 255
      EmptyStrToNull = True
    end
    object dsGarantSUMMA: TFIBBCDField
      FieldName = 'SUMMA'
      DisplayFormat = '#,##0.00'
      EditFormat = '0.00'
      Size = 2
      RoundByScale = True
    end
    object dsGarantCLOSED: TFIBSmallIntField
      DefaultExpression = '0'
      FieldName = 'CLOSED'
    end
    object dsGarantCLOSEDATE: TFIBDateField
      FieldName = 'CLOSEDATE'
      DisplayFormat = 'dd.mm.yyyy'
    end
    object dsGarantCREATEDATE: TFIBDateField
      DefaultExpression = 'current_date'
      FieldName = 'CREATEDATE'
      DisplayFormat = 'dd.mm.yyyy'
    end
    object dsGarantCREATOR: TFIBStringField
      FieldName = 'CREATOR'
      Size = 120
      EmptyStrToNull = True
    end
    object dsGarantMODIFYDATE: TFIBDateField
      FieldName = 'MODIFYDATE'
      DisplayFormat = 'dd.mm.yyyy'
    end
    object dsGarantMODIFIER: TFIBStringField
      FieldName = 'MODIFIER'
      Size = 120
      EmptyStrToNull = True
    end
  end
  object dscGarant: TDataSource
    DataSet = dsGarant
    Left = 360
    Top = 60
  end
  object dsGarantInsert: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE RST_GARANT'
      'SET '
      '    DOCDATE = :DOCDATE,'
      '    NOTES = :NOTES,'
      '    SUMMA = :SUMMA,'
      '    CLOSED = :CLOSED'
      'WHERE'
      '    ID = :OLD_ID'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO RST_GARANT('
      '    ID,'
      '    DEBT_ID,'
      '    DOCDATE,'
      '    NOTES,'
      '    SUMMA,'
      '    CLOSED'
      ')'
      'VALUES('
      '    :ID,'
      '    :DEBT_ID,'
      '    :DOCDATE,'
      '    :NOTES,'
      '    :SUMMA,'
      '    :CLOSED'
      ')')
    SelectSQL.Strings = (
      'SELECT'
      '    RID'
      'FROM'
      '    RST_GARANT_INS(:PDEBT_ID) ')
    Transaction = trCard
    Database = MAINDM.MainDB
    CSMonitorSupport.Enabled = csmeTransactionDriven
    Left = 362
    Top = 94
    object dsGarantInsertRID: TFIBIntegerField
      FieldName = 'RID'
    end
  end
  object dsGetDebt: TpFIBDataSet
    SelectSQL.Strings = (
      'select'
      '    g.debt_id'
      'from'
      '    rst_garant g'
      'where g.id = :pgarant_id')
    Transaction = trCard
    Database = MAINDM.MainDB
    CSMonitorSupport.Enabled = csmeTransactionDriven
    Left = 360
    Top = 130
    object dsGetDebtDEBT_ID: TFIBIntegerField
      FieldName = 'DEBT_ID'
    end
  end
end
